//
// Created by PC on 2017/12/22.
//

#ifndef READGRAPH_DENSEGRPAH_H
#define READGRAPH_DENSEGRPAH_H
#include <iostream>
#include <vector>
#include <cassert>

using namespace std;

class DenseGrpah{
private:
    int n,m;
    bool directed;
    vector<vector<bool>> g;
public:
    DenseGrpah(int n,bool directed){
        assert(n>=0);
        this->n=n;
        this->m=0;
        this->directed = directed;
        g=vector<vector<bool>> (n,vector<bool>(n, false));
    }
    ~DenseGrpah(){}
    int V(){return n;}
    int E(){return m;}

    void addEdge(int v, int w) {
        assert(v >= 0 && v < n);
        assert(w >= 0 && w < n);
        if(hasEdge(v,w))
            return;
        g[v][w]=true;
        if(!directed)
            g[w][v]=true;
        m++;
    }

    bool hasEdge(int v, int w) {
        assert(v >= 0 && v < n);
        assert(w >= 0 && w < n);
        return g[v][w];
    }
    void show(){
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < n; ++j) {
                cout<<g[i][j]<<"\t";
            }
            cout<<endl;
        }
    }
};
#endif //READGRAPH_DENSEGRPAH_H
